#!/bin/bash

# 文件路径
file="/tmp/tmp/patch.txt"

# 逐行读取文件
while IFS= read -r line
do
    echo "**********************************************************************"
    patch -p1 < $line
    if [ $? -ne 0 ]; then
        exit -1
    fi
    find . -name "*.orig" |xargs rm -rf
    find . -name "*.rej" |xargs rm -rf
    git add -A
    file_name=$(basename "$line")
    git commit -m "sync https://gitee.com/src-openeuler/sysSentry/blob/openEuler-20.03-LTS-SP4/$file_name"
    git log -1 
    sleep 5

done < "$file"
